Implement global package search for build chroot results#4154
Implement global package search for build chroot results#4154sundaram123krishnan wants to merge 1 commit intofedora-copr:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a global package search feature, which is a valuable addition. The implementation is well-structured, including a new form, view, logic, template, and tests. I've identified a couple of areas for improvement in the view logic and form validation that would enhance maintainability and performance. My suggestions focus on refactoring repetitive code and optimizing a database query.
| has_value = any([ | ||
| self.name.data, | ||
| self.version.data, | ||
| self.release.data, | ||
| self.arch.data, | ||
| self.epoch.data is not None, | ||
| ]) | ||
| if not has_value: | ||
| self.name.errors.append("At least one search field must be provided") | ||
| return False |
There was a problem hiding this comment.
The logic to check if at least one field has a value is duplicated here and in the search_params method. You can simplify this by calling self.search_params() and checking if the resulting dictionary is empty. This avoids code duplication and makes the validation more maintainable.
if not self.search_params():
self.name.errors.append("At least one search field must be provided")
return False30faadf to
65d3c33
Compare
65d3c33 to
4c73317
Compare
Fixes #1947